package tech.eyao.hs60x.dao;

import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import tech.eyao.hs60x.dto.StepDTO;
import tech.eyao.hs60x.mapper.StepDOMapper;
import tech.eyao.hs60x.model.domain.StepDO;
import tech.eyao.hs60x.vo.StepQuery;

@Repository
public class StepDao {
	@Autowired
	private StepDOMapper stepDOMapper;
	
	public boolean deleteByPrimaryKey(Long id) {
		return stepDOMapper.deleteByPrimaryKey(id) > 0; 
	}

    public boolean insert(StepDO record) {
    	record.setGmtCreated(new Date());
    	record.setGmtModified(new Date());
    	return stepDOMapper.insert(record) > 0;
    }

    public StepDO selectByPrimaryKey(Long id) {
    	return stepDOMapper.selectByPrimaryKey(id);
    }

    public boolean updateByPrimaryKey(StepDO step) {
    	step.setGmtModified(new Date());
    	return stepDOMapper.updateByPrimaryKey(step) > 0;
    }

	public StepDO getCurrDayStep(long watchId, Date date) {
		return stepDOMapper.getCurrDayStep(watchId, date);
	}

	public List<StepDO> list(StepQuery pageQuery) {
		return stepDOMapper.list(pageQuery);
	}
}
